package com.firefly.web.controller.admin.shop;

import com.firefly.web.controller.admin.ConsoleApiRestController;
import com.firefly.dao.dto.shop.AreaDto;
import com.firefly.dao.vo.CommonListVo;
import com.firefly.service.command.shop.AreaCommand;
import com.firefly.service.query.shop.AreaQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * @description:
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2023/2/1
 **/
@ConsoleApiRestController("area")
public class AreaController {
    private final AreaQuery areaQuery;
    private final AreaCommand areaCommand;
    @Autowired
    public AreaController(AreaQuery areaQuery,AreaCommand areaCommand){
        this.areaQuery = areaQuery;
        this.areaCommand = areaCommand;
    }
    @GetMapping("list")
    public CommonListVo getList(int parentId){
        return areaQuery.getList(parentId);
    }
    @PostMapping("display")
    public Boolean updateDisplay(@Validated AreaDto request){
        return areaCommand.updateDisplay(request);
    }
}
